#-*- coding:utf-8 -*-

import itchat
from captrue import getCaptrue
@itchat.msg_register(['Text',])
def text_reply(msg):
    if msg['ToUserName'] == 'filehelper':
        if msg['Text'] == "monitor":
            f = getCaptrue()
            try:
                itchat.send_image(f, toUserName=msg['ToUserName']) #如果是其他文件可以直接send_file
                print("success")
            except:
                print("fail")
        else:
            print '%s:%s' %(msg['ToUserName'],msg['Text'])


# hotReload=True表示热登录
itchat.auto_login(hotReload=True)
itchat.run()
